package com.inversion;



public class Inversion2 {

    /**
     * main方法是客户端
     */
    public static void main(String[] args) {
        new Person2().recetive(new Email2());
        new Person2().recetive(new WeiXin());
    }
}

/**
 * 发送信息接口
 */
interface IReceiver{
    public String send();
}

/**
 * 邮件类
 */
class Email2 implements IReceiver{
    //发送邮件
    public String send(){
        return "发送邮件内容：Email-Hello-World";
    }
}

/**
 * 微信类
 */
class WeiXin implements IReceiver{
    //发送微信
    public String send(){
        return "发送微信内容：WeiXin-Hello-World";
    }
}
/**
 * 人类
 */
class Person2{
    /**
     * 人接收消息
     */
    public void recetive(IReceiver iReceiver){
        System.out.println(iReceiver.send());
    }
}
